package controller

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

type JsonStruct struct {
	Code int         `json:"code"`
	Msg  interface{} `json:"msg"`
	Data interface{} `json:"data"`
}

func ReturnSuccess(c *gin.Context, code int, msg string, data interface{}) {
	c.JSON(http.StatusOK, JsonStruct{code, msg, data})
}

func ReturnError(c *gin.Context, code int, msg string) {
	c.JSON(http.StatusOK, JsonStruct{code, msg, nil})
}
